How many types of operators are there in JavaScript?
Types of operators in JavaScript
338
19-Jul-2021
Updated on 19-Jul-2021
Ethan Karla
20-Jul-2021JavaScript operators are symbols that are used to perform operations on operands. For example:
var sum=10+20;
Here, + is the arithmetic operator and = is the assignment operator.
There are following types of operators in JavaScript.
Arithmetic Operators
Arithmetic operators are used to perform mathematical operations between numeric operands.
Comparison Operators
JavaScript language includes operators that compare two operands and return Boolean value true or false.
Logical Operators
Logical operators are used to combine two or more conditions. JavaScript includes following logical operators.
Assignment Operators
JavaScript includes assignment operators to assign values to variables with less key strokes.
Ternary Operator
JavaScript includes special operator called ternary operator :? that assigns a value to a variable based on some condition. This is like short form of if-else condition.